<template>
	<view>
		<view class="u-padding-20 u-flex">
			入场时间：<picker mode="date" :value="date1" @change="chang">{{date1 == ''?'请选择时间':date1}}</picker>
		</view>
		<view class="u-padding-20 u-flex" @click="show2 = true">
			出场时间：<picker mode="date" :value="date2" @change="chang2">{{date2 == ''?'请选择时间':date2}}</picker>
		</view>
		<uni-group>
			<button type="primary" @click="dian" >点击搜索</button>
		</uni-group>
		<uni-group title="历史停车记录">
			<uni-card v-for="(item,index) in che" :title="item.parkName">
				<view @click="xoam(item.id)">
					<view>车牌号：{{item.plateNumber}}</view>
					<view>收费金额：{{item.monetary}}元</view>
					<view>入场时间：{{item.entryTime}}</view>
					<view>出场时间：{{item.outTime}}</view>
				</view>
			</uni-card>
			<button @click="chan" type="primary" v-if="tt"> 查看更多</button>
		</uni-group>
		
	</view>
</template>

<script>
	import api from 'commer/apiURL.js'
	export default {
		data() {
			return {
				tt: true,
				show:false,
				base: api.baseurl,
				date1: '',
				date2:'',
				che: '',
				list: [],
				show2:false,
			}
		},
		onLoad() {
			this.getlun()
		},
		methods: {
			dian(){
				this.getlun(this.date1,this.date2)
			},
			chang(e){
				this.date1 = e.detail.value
			},
			chang2(e){
				this.date2 = e.detail.value
			},
			chan() {
				this.che = this.list
				this.tt = false
			},
			getlun(date,date2) {
				this.$get(this.base + '/prod-api/api/park/lot/record/list', {
					entryTime: date,
					outTime: date2
				}).then((res) => {
					this.list = res.rows
					this.che = res.rows.slice(0, 5)
				})
			}
		}
	}
</script>

<style>

</style>
